home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WWTCLKit / PAThumbWheelCell.h < prev    next >
Encoding:
Text File  |  1995-03-22  |  4.5 KB  |  151 lines

  1. #import <appkit/appkit.h>
  2.  
  3. /******************************************************************************
  4.     PAThumbWheelCell
  5.     
  6. PAThumbWheel offers the functionality of Slider plus the features that you would expect from a real thumbwheel (including 2 3/4 D Graphics!).
  7.  
  8. PAThumbWheel has a linear display mode and a radial display mode and offers the ability to assign a value to the visible region of the control as well as an absolute value that the ThumbWheel will either ignore, bound to or wrap around.
  9.  
  10. PAThumbWheel can also return relative values via its -relativeIntValue & -relativeFloatValue methods. A snap back option allows mouse loops to start from and return to a base value.
  11.  
  12. Copyright 1992, Jeff Martin. (jmartin@next.com 415-780-3833)
  13. ******************************************************************************/
  14. @interface PAThumbWheelCell : ActionCell
  15. {
  16.     int        displayMode;    // DISPLAY_MODE_LINEAR or DISPLAY_MODE_RADIAL
  17.     int        direction;        // DIRECTION_HORIZONTAL or DIRECTION_VERTICAL
  18.  
  19.     float    floatValue;        // Float value of TW
  20.     float    lastFloatValue;    // Used to calculate relative change in value
  21.  
  22.     float    visMax;            // Value at top or right point
  23.     float    visMin;            // Value at bottom or left point
  24.  
  25.     int        absMode;        // ABSOLUTE_UNBOUNDED, _BOUNDED and _WRAPPED
  26.     float    absMax;            // Max value (meaningless if unbounded)
  27.     float    absMin;            // Min value (meaningless if unbounded)
  28.     
  29.     BOOL    snapsBack;        // Whether TW snaps back to a value when done
  30.     float    snapBackValue;    // Value to snap back to (typically 0)
  31.  
  32.     int        dashInterval;    // How often to draw a dash (in points or degrees)    
  33.     BOOL    showMainDash;    // Set this to NO if you only want relative values
  34.  
  35.     NXColor color;            // Color of the Thumbwheel
  36.     NXImage    *image;            // Background of Thumbwheel in radial mode
  37.     NXRect    cellFrame;        // Frame of the cell at track mouse time.
  38.  
  39.         BOOL  colorChanged;
  40. }
  41.  
  42. - init;
  43.  
  44. // Overridden Cell Methods
  45. - (BOOL)continueTracking:(const NXPoint *)lastPoint 
  46.     at:(const NXPoint *)currPoint inView:view;
  47. - stopTracking:(const NXPoint *)lastPoint at:(const NXPoint *)stopPoint
  48.     inView:view mouseIsUp:(BOOL)flag;
  49.  
  50. // The value that corresponds to a point relative to visible range and frame
  51. - (float)floatValueAtPoint:(NXPoint)point forFrame:(NXRect)frame;
  52.  
  53. // Direction: vertical or horizontal
  54. - (int)direction;
  55. - setDirection:(int)dir;
  56. - (BOOL)isVertical;
  57. - setVertical;
  58. - (BOOL)isHorizontal;
  59. - setHorizontal;
  60.  
  61. // DisplayMode: radial or linear
  62. - (int)displayMode;
  63. - setDisplayMode:(int)mode;
  64. - (BOOL)isRadial;
  65. - setRadial;
  66. - (BOOL)isLinear;
  67. - setLinear;
  68.  
  69. // Visible min and max
  70. - (float)visibleMax;
  71. - setVisibleMax:(float)max;
  72. - (float)visibleMin;
  73. - setVisibleMin:(float)min;
  74. - (float)visibleRange;
  75. - (float)middleValue;
  76.  
  77. // Absolute mode: unbounded, bounded or wrapped
  78. - (int)absoluteMode;
  79. - setAbsoluteMode:(int)mode;
  80. - (BOOL)isUnbounded;
  81. - setUnbounded;
  82. - (BOOL)isBounded;
  83. - setBounded;
  84. - (BOOL)isWrapped;
  85. - setWrapped;
  86. - (float)absoluteMax;
  87. - setAbsoluteMax:(float)value;
  88. - (float)absoluteMin;
  89. - setAbsoluteMin:(float)value;
  90. - (float)absoluteRange;
  91.  
  92. // Relative Values
  93. - (int)relativeIntValue;
  94. - (float)relativeFloatValue;
  95. - resetRelativeValue;
  96.  
  97. // Snap back characteristic
  98. - (BOOL)snapsBack;
  99. - setSnapsBack:(BOOL)flag;
  100. - (float)snapBackValue;
  101. - setSnapBackValue:(float)val;
  102.  
  103. // Dash interval (set in degrees or points depending on displayMode)
  104. - (float)dashInterval;
  105. - setDashInterval:(float)val;
  106.  
  107. // Showing the main dash
  108. - (BOOL)showMainDash;
  109. - setShowMainDash:(BOOL)flag;
  110.  
  111. // Color of the ThumbWheel
  112. - (NXColor)color;
  113. - setColor:(NXColor)color;
  114.  
  115. // Shift calcs the shift of the dashes from the floatValue, visRange & frame
  116. - (int)shift:(const NXRect *)frame;
  117.  
  118. // Override highlight:inView:lit: so that it does nothing
  119. - highlight:(const NXRect *)frame inView:view lit:(BOOL)flag;
  120.  
  121. // Override this so that we track mouse whether or not it is on top of us.
  122. + (BOOL)prefersTrackingUntilMouseUp;
  123.  
  124. - setColorChanged:(BOOL)flag;
  125. - (BOOL)colorChanged; 
  126.  
  127. // stolen from PAThumbWheelCellDrawing.h
  128. //
  129. - drawSelf:(const NXRect *)frame inView:view;
  130. - getDashesForFrame:(const NXRect *)frame :(float **)pnts :(int *)pntCount :(char **)ops :(int *)opCount;
  131. - generateImage:(const NXRect *)frame;
  132.  
  133. - (const char *)getInspectorClassName;
  134.  
  135. @end
  136.  
  137. // next 3 lines taken from PAThumbWheelCellDrawing.h...
  138. NXColor PAScaleRGBColor(NXColor color, float scale);
  139. float IntSin(int x);
  140. #define IntCos(x) IntSin((x)+90)
  141.  
  142. #define DISPLAY_MODE_LINEAR        0
  143. #define DISPLAY_MODE_RADIAL        1
  144.  
  145. #define DIRECTION_HORIZONTAL    0
  146. #define DIRECTION_VERTICAL        1
  147.  
  148. #define ABSOLUTE_UNBOUNDED        0
  149. #define ABSOLUTE_BOUNDED        1
  150. #define ABSOLUTE_WRAPPED        2
  151.